// created by noellynch
// Aug 10, 2010

package com.sceneworker.launcher;

import java.io.File;
import java.io.IOException;

public class ReleaseLauncher {

	public static String getOsName(){
		return System.getProperty("os.name");
	}
	
	static	public	boolean		isWindows() {
		return getOsName().startsWith("Windows");
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String		lstr_launchString = "java -Xms256m -Xmx1g -Djava.library.path=./natives";
		String		lstr_cpString = "";	
		File		lcl_f = new File("libs");
		
		for(File lcl_rF : lcl_f.listFiles()) {
			if(lcl_rF.getName().lastIndexOf(".jar") != -1) {
				lstr_cpString += "libs/" + lcl_rF.getName();
				
				if(isWindows()) {
					lstr_cpString += ";";
				} else {
					lstr_cpString += ":";
				}
			}
		}
		
		lstr_cpString += "./";
		
		lstr_launchString += " -classpath " + lstr_cpString + " com.sceneworker.app.SceneWorkerAppMain";
		System.out.println(lstr_launchString);
		
		try {
			Runtime.getRuntime().exec(lstr_launchString);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
